/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package airacrobats.io;

import airacrobats.io.data.AirplaneData;
import airacrobats.io.data.SquadronData;
import java.io.DataInputStream;
import java.io.IOException;
import javax.vecmath.Point3f;

/**
 *
 */
public class SquadronLoader extends DataLoader<SquadronData>
{
    /**
     * Constructor.
     */
    public SquadronLoader()
    {

    }

    /**
     */
    protected SquadronData load(DataInputStream dataInputStream) throws IOException
    {
        float scaleFactor = dataInputStream.readFloat();
        float cruiseSpeed = dataInputStream.readFloat();
        float maximumSpeedFactor = dataInputStream.readFloat();
        float enginePower = dataInputStream.readFloat();
        Point3f xAxis = new Point3f(dataInputStream.readFloat(), dataInputStream.readFloat(), dataInputStream.readFloat());
        Point3f yAxis = new Point3f(dataInputStream.readFloat(), dataInputStream.readFloat(), dataInputStream.readFloat());
        Point3f propellerPosition = new Point3f(dataInputStream.readFloat(), dataInputStream.readFloat(), dataInputStream.readFloat());
        int radioSounds = dataInputStream.readByte();
        return new SquadronData(new AirplaneData(scaleFactor, cruiseSpeed, maximumSpeedFactor,
                enginePower, xAxis, yAxis, propellerPosition), radioSounds);
    }
}
